'use strict';

const Controller = require('egg').Controller;

class HomeController extends Controller {
  async index() {
    this.ctx.body = { data: 'Egggggggg!' };
    this.ctx.status = 200;
  }

  async post() {
    const name = this.ctx.request.body.name
    this.ctx.body = { name: name };
    this.ctx.status = 200;
  }

  async verify() {
    const token = this.ctx.request.header.authorization
    const data = this.ctx.helper.verifyToken(token);
    this.ctx.body = { data: data };
    this.ctx.status = 200;
  }
}

module.exports = HomeController;
